home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
GRAPTIES
/
SD204.LZH
/
BOX.DOC
< prev
next >
Wrap
Text File
|
1980-01-01
|
60KB
|
1,690 lines
BOX
A Program for Creating
and Editing Screen Images
version 1.3
(C) Copyright 1986,1987,1988 by Nescatunga Software
All Rights Reserved
Registration Fee: $20.00
=======================================================
BOX USER GUIDE PAGE 2
=======================================================
TABLE OF CONTENTS
License and Registration Information..................3
Introduction..........................................4
Making Backup Copies..................................5
Running BOX on a Floppy-Based System..................5
Installing BOX on a Hard Disk.........................5
Running BOX on a Hard Disk System.....................6
The Main Menu.........................................6
Draw Menu...........................................7
Load from Disk......................................8
Save to Disk........................................8
ASCII File Format...................................9
Memory File Format..................................9
Packed File Format.................................10
Path/Directory.....................................11
Clear Screen.......................................11
Exit Program.......................................11
The Draw Menu Functions..............................12
Type Labels........................................12
Insert Mode (Ins)................................12
Delete Line (F9).................................13
Insert Line (F10)................................13
Draw Boxes.........................................13
Move...............................................14
Color Change.......................................14
Block Functions....................................15
Select Box Drawing Style...........................16
Repeat.............................................16
Paint Areas........................................17
Erase..............................................18
On the Fly Changes.................................19
ASCII Table.......................................19
Turbo Pascal Programming Considerations..............20
Displaying ASCII Format Screens....................20
Displaying Memory Format Screens...................20
Displaying Packed Format Screens...................21
Using BOX Screens for Context Sensitive Help.......21
Address.Pas, a Complete Example Program..............23
Capturing screens from other programs with GRAB......23
=======================================================
BOX USER GUIDE PAGE 3
=======================================================
LICENSE AND REGISTRATION
BOX is user supported software copyrighted by the
author who reserves all rights. You are granted a
limited license to use the program under the terms
below.
You may copy the BOX disk to evaluate it or to give to
others to evaluate so long as no price or other
consideration is charged.
Shareware distribution organizations may copy the BOX
diskette and share it with their members so long as no
price is charged other than a reasonable distribution
fee not to exceed the cost of a diskette and handling.
The program, associated files and documentation must
always be distributed together. You may not modify the
program or the documentation. You may not reprint the
program manual in any way.
Schools may copy BOX as many times as needed so long as
the registration fee has been paid for each building
the program will be used in.
REGISTRATION FEE
If you find BOX useful please register as a BOX user by
sending $20.00 to:
Nescatunga Software
Box 5942
Katy, TX 77450
For registering you will receive the latest version of
the BOX program and a printed copy of the
documentation.
Although BOX is relatively small and tightly focused in
its purpose, it represents many hours of work. We can
continue to enhance BOX and develop other shareware
products ONLY if you support the product and the
shareware concept.
=======================================================
BOX USER GUIDE PAGE 4
=======================================================
INTRODUCTION
BOX and the other programs on this diskette represent a
sophisticated screen design and display system. With
the BOX system you can add eye-popping data entry
screens and instant context-sensitive help screens to
your Turbo Pascal and C programs. The components of
the system are:
BOX, the world's best screen designing editor.
LOADFILE.PAS, a Pascal Unit which contains complete
source code for displaying BOX-created screens in
your programs. Also on the diskette are several
other useful Pascal Units such as IOSTUFF and
MENUBOX.
ADDRESS.PAS, a complete example program in Turbo
Pascal source code, which shows how to use BOX-
created screens for program logos, for context
sensitive help and for database entry.
GRAB, a memory resident screen capture program you
can use to take snapshots of screens in any program.
Full documentation for all of the above.
The main attraction, however, is BOX, the screen
editor. With it you can create snazzy, professional-
looking data entry screens and help screens in minutes
rather than hours.
To use BOX you start with a blank screen. Then, using
special screen editing functions, you type, paint,
shade, fill, draw boxes or erase in any color
combination you desire. BOX has several unique
functions such as REPEAT, BLOCK and ASCII-Table-
Selection which are tailored specifically to screen
creation and far exceed what is available in text
editors. Drawing intricate intersecting boxes is
literally child's play.
When you've got the screen just right you SAVE the
screen image to disk. This screen image file now is
available to be loaded directly onto the screen from a
Pascal or C program. Later if you decide to make
changes to the screen it is a snap to LOAD it back into
BOX's editor and make the changes.
=======================================================
BOX USER GUIDE PAGE 5
=======================================================
BOX works in regular text mode and uses regular ASCII
characters so that any BOX-created screen may be
displayed on any color or monochrome monitor.
Applications for BOX screens include:
Input screens for data base entry
Menus
Help Screens
Program Logo screens
Demonstration Screens
Program Prototyping
Computer "doodling"
BOX will run on any IBM PC (CGA, EGA or Monochrome)
under DOS. We have tested BOX on several IBM
compatible PCs and have discovered no problems. Be
aware however that BOX incorporates several low-level
functions which may not work on some IBM near-
compatibles. Please let us know the nature of any
problems you discover on your system.
The diskette also contains ADDRESS.PAS, a complete
example application. ADDRESS uses BOX screens for its
program logo, as context-sensitive help screens and as
a database entry screen. The ADDRESS program includes
procedures which pop the BOX-created screens onto the
monitor instantly. You are free to use these
procedures in your own Turbo Pascal programs. The
procedures are not complicated and could be easily
translated into C for example.
Also included with ADDRESS are several other powerful
Pascal Units taken from Turbo Overdrive Package, TOP,
another shareware product from Nescatunga Software.
The full TOP package costs $20.00 from Nescatunga
Software and comes with source code and printed
documentation.
MAKING BACKUP COPIES
BOX is not copy protected so make as many back-up
copies as you think you will need. To make back-up
copies or distribution copies for other users first
boot up your computer with DOS. Place the BOX diskette
in the A drive and a blank, formatted diskette in the B
drive. At the A prompt type the following command to
copy all files from the A diskette to the B diskette:
=======================================================
BOX USER GUIDE PAGE 6
=======================================================
A> COPY A:*.* B:
RUNNING BOX ON A FLOPPY-BASED SYSTEM
To use BOX on a floppy disk system first boot up your
computer with DOS. Put the BOX diskette in the A drive
and type the following command at the A prompt:
A> BOX
The BOX program will start by displaying a logo with
the word BOX outlined on the screen. Remember that BOX
looks for its logo file and its help files on the same
drive where it is started. So don't start the program
from another drive, as shown in the example below.
B> A:BOX (Wrong)
After you have started BOX you may easily change the
default data drive or directory.
INSTALLING BOX ON A HARD DISK
To install BOX on a hard disk first make a new
directory to hold the BOX files. Change to that
directory and, with the BOX diskette in the A drive,
copy all BOX files to the directory as shown below:
C> MD\BOXX
C> CD\BOXX
C> COPY A:*.* C:
The three commands above will create a new directory
named BOXX, change to that directory and copy all BOX
files from the BOX diskette to the BOXX directory on
the hard disk. If you would prefer to leave the BOX
documentation and example programs on the disk then
substitute the following COPY statements for the one
above:
C> COPY A:BOX.EXE C:
C> COPY A:BOXHELP.* C:
C> COPY A:BOXLOGO. C:
RUNNING BOX ON A HARD DISK SYSTEM
=======================================================
BOX USER GUIDE PAGE 7
=======================================================
To start the BOX program, issue the following two
commands to change to the BOXX directory and initiate
the program:
C> CD\BOXX
C> BOX
Remember that BOX must be started from the same
directory and drive as its associated files. You can
easily change the default path later.
THE MAIN MENU
BOX is a snap to use because it uses the following
conventions which are standard with many popular
software products:
"Point and Shoot" Menus
"Escape" for abort or return to menu
"F1" for Help
In fact, if you're in a hurry to try BOX, go ahead.
The program's user interface is intuitive and you will
likely be using all of BOX's features (except for BOX's
"on the fly" drawing changes which are well hidden)
without reading this manual. However to get the most
from BOX it is a good idea to come back and read this
manual later to see if you may have missed a trick or
two.
If you get stuck running BOX just hit F1 for help and
one of BOX's seven context-sensitive help screens will
appear. These help screens are a condensed version of
this documentation.
While we're talking about BOX's help screens it is
interesting to note that they were created with BOX and
are displayed by the same Pascal routines given in the
example programs on the diskette.
When you start BOX the main menu will appear. To
select an action from the menu move the lightbar with
the arrow keys and hit enter. Or just hit the first
letter of item's description. For example hit S if you
want to SAVE from the main menu. Hitting the letter S
is equivalent to placing the lightbar on SAVE and
hitting enter. After you become familiar with the
commands you probably will find this second approach
more efficient.
=======================================================
BOX USER GUIDE PAGE 8
=======================================================
Hitting the Esc while under one of BOX's menus will
abort that menu and take you to the next higher menu.
On the main menu however, hitting the Esc key will
cause an Exit from the BOX program (after a safety
prompt).
EDIT MENU
If you select EDIT MENU from the main menu, another
menu will appear with a list of selections for drawing
and painting boxes on the screen. From the EDIT menu
you may :
Type labels and text on the screen
Draw boxes like an etch-a-sketch
Move around the screen without drawing
Change background and foreground colors
Move, clone and paint blocks of the screen
Choose between four box drawing styles
Repeat any character in any direction
Paint the boxes any color (including blink)
Erase lines drawn in error
These seven functions make it easy, even fun, to create
a screen image. I'll return to the EDIT menu later and
cover each of the functions in detail. But first let's
cover the other functions on the main menu.
LOAD FROM DISK
The LOAD function loads a screen image file you have
saved previously with the SAVE TO DISK function
described in the next section. To load a file first
select the file format the original screen was saved
under; either ASCII, Memory or Packed (see description
under SAVE below). BOX will then display a directory
of files on the current drive/path and prompt you for
the file name. Type the file name you want to load and
hit enter.
If the file you want to load is not on the current
drive/path you have two options. First you may hit
escape to return to the main menu and there select
PATH/DIRECTORY to change the drive/path then return to
the LOAD screen to load the file. Or you may simply
type the drive and directory prefix to the file name at
the bottom of the LOAD screen.
=======================================================
BOX USER GUIDE PAGE 9
=======================================================
You may LOAD standard ASCII files created with other
editors (including Turbo Pascal's) and word processors.
But BOX will LOAD only the leftmost 80 characters of
the first 25 lines. Take care not to LOAD a file
longer than 25 lines then SAVE it with the same name.
BOX will overwrite the original file but save only the
first 25 lines. Any additional lines will be lost.
SAVE TO DISK
The save function writes a disk file containing the
screen image you have created and edited with BOX's
DRAW and TYPE functions. To use SAVE you must first
select the file format and, when prompted, provide a
file name. Please note that BOX remembers the last
file name you used so BOX will SAVE the modified screen
under that same file name unless you change it.
ASCII FILE FORMAT
With BOX you may store a screen image in one of three
different formats; the ASCII format, the Memory format
and the Packed format.
The ASCII format is the simplest and most standard of
the three because it saves the screen in a text format
that most word processors and editors (including Turbo
Pascal's editor) recognize. ASCII files may therefore
be further edited and printed with many other editors
and word processors or included directly in you
program's source code.
However saving a BOX screen image in the ASCII format
has some disadvantages. First, ASCII files lose all of
the color attributes you may have drawn or painted on
the screen. In addition ASCII screen images must be
displayed line-by-line which results in a slower
display.
MEMORY FILE FORMAT
Memory format files, because they are essentially a
snapshot "dump" of the video memory buffer, retain all
color attributes (including blink) and can be instantly
flashed on the screen using the code examples later in
=======================================================
BOX USER GUIDE PAGE 10
=======================================================
this manual. Memory files, however, will look like
gibberish to most editors and word processors. Usually
this will present no problem since you can always edit
memory format files with BOX.
Many of the commonly available screen-capture programs
use the Memory format. GRAB.COM, a program contained
on the BOX disk, is a TSR (memory resident) screen-
capture program which you can use to capture screen
from other programs. When activated with ALT-PrtSc,
GRAB saves the current screen image to the current disk
drive in a Memory format. There are more instructions
for using GRAB in it own documentation file.
PACKED FILE FORMAT
Except for one difference, Packed format files are
identical to Memory format files. They retain all
color attributes and can be popped on the display
instantly. The difference is that Packed format files
use a simple run-length-encoding algorithm to compress
the size of the file when it is written to the disk.
You can save considerable space by using Packed format
files if your screens have several blank lines or
bordered boxes.
Memory format files always require 4000 bytes of
storage. A typical Packed format file will require
around 2000 bytes. You should be aware, however, that
in extreme cases (where every other character is
different for example) a Packed format file can
actually be larger than 4000 characters. If you are
not sure which format to use, save your screen under
both formats with a different name then examine the
size of the files with a Directory command.
Another consideration is that, because your Pascal
program must decode and expand the packed file (the
procedure is shown in the example programs) it takes
just a fraction of a second longer to load than a
Memory format file. The difference is barely
perceptable even on slower 8086 computers.
You must decide which of the three formats gives the
greatest advantage to your requirements. Personally I
prefer the Memory format for its simplicity and
flexibility.
=======================================================
BOX USER GUIDE PAGE 11
=======================================================
In saving BOX files you may use any file names you
wish. Please note, however, that if you do not add
file extensions (a period followed by three characters
at the end of your file name) BOX will add them for you
using the following conventions:
ASCII files xxxxxxxx.ASC
Memory files xxxxxxxx.MEM
Packed files xxxxxxxx.PAK
If you choose to use the conventions above for your
file names, BOX will highlight any file names that
match the format you are using when it displays the
directory of files during LOADing.
PATH/DIRECTORY
With the PATH/DIRECTORY facility, which is available
from the Main menu, you can change the drive/path where
BOX will store or retrieve screen-image files.
CLEAR SCREEN
The CLEAR SCREEN choice on the main menu brings up a
submenu with several screen-initialization functions.
CLEAR
The CLEAR function erases all characters on the
screen and sets the colors to those you have chosen.
Use it when you have just saved a screen image and
want to start with a fresh blank screen.
COLOR CHANGE
This choice on the CLEAR menu brings up a color
smorgasbord for selecting the colors you wish to
have on the cleared screen.
FILL
Select FILL to fill the entire screen with a
character. An ASCII character selector box will pop
up to allow you to select any of the 255 ASCII
characters. With these characters you can create
many interesting patterns.
PAINT SCREEN
=======================================================
BOX USER GUIDE PAGE 12
=======================================================
PAINT changes the background and foreground colors
on the screen but does not erase the characters.
X EXIT
Select EXIT on the main menu to leave the BOX program.
If your last step was to SAVE a file, BOX will return
control to DOS immediately. However if your last
operation was not a SAVE, BOX will ask you if you
really want to EXIT.
THE EDIT MENU FUNCTIONS
Now let's return to the EDIT MENU and examine each of
its functions in more detail. When you select EDIT
from the main menu, BOX will display a list of
selections for drawing and painting boxes on the screen
including:
Type labels and text on the screen
Draw boxes like an etch-a-sketch
Move the cursor around the screen without drawing
Change background and foreground colors
Move or paint blocks on the screen
Select from among four box drawing styles
Repeat any character in any direction
Paint the boxes any color (including blink)
Erase lines drawn in error
Let's cover each of these functions in order:
TYPE LABELS
TYPE, which is the first function on the EDIT Menu, is
a simple, full-screen text editor you can use to type
text on a screen image. After you have selected TYPE
simply locate the cursor where you want it on the
screen and type whatever text you need. Since BOX
works with only one screen at a time the limits of the
typing area is 80 characters wide by 25 lines long -- a
full screen in 80 character text mode.
INSERT MODE
=======================================================
BOX USER GUIDE PAGE 13
=======================================================
In the TYPE function you may toggle the insert mode on
and off by hitting the Ins. key. A large block cursor
indicates that Insert is on, a small line cursor
indicates that Insert is off. If Insert is on, all
characters to the right of the cursor will be pushed to
the right when you type. BOX does not word wrap nor
does it save the characters that you push off the
screen. Please remember that if you have the insert
mode on and you hit the enter key you will break the
line at the cursor location and carry the tail of the
line to a new line below. If insert mode is off the
cursor will jump to the next line but it will not carry
the tail of the line.
DELETE LINE => F9
To delete a line, place the cursor on the line you wish
to delete and hit F9. All lines below the deleted line
are brought up one line and a blank line will be
inserted at the bottom of the screen. The blank line
will be in the current color scheme.
INSERT LINE => F10
To insert a blank line, place the cursor just below the
location you want the line inserted and hit F10. All
lines below the inserted line will be pushed down one
and the last line of the screen will be lost.
DRAW BOXES
Select DRAW BOXES from the DRAW MENU to draw lines and
boxes using the arrow keys on the cursor control pad.
Think of DRAW as lowering a drawing pen onto the
drawing pad (the screen). Lines will follow wherever
you direct the cursor--up, down, left or right. If you
cross another line special logic in BOX will
automatically draw the proper intersection or joining
character. DRAW will use whatever colors and box style
you have previously selected. So you may wish to
select COLOR CHANGE and BOX CHANGE from the DRAW MENU
before you select DRAW.
MOVE
=======================================================
BOX USER GUIDE PAGE 14
=======================================================
MOVE is the opposite of DRAW. MOVE lifts the box-
drawing pen so that you may move the cursor with the
arrow keys to a new location without trailing a line
behind you. When you have moved the cursor to the new
location, select DRAW to start drawing again. You may
also move the cursor without drawing if you select the
TYPE function from the menu.
COLOR CHANGE
When you select COLOR CHANGE from the DRAW MENU a color
selection smorgasbord will appear on the screen. To
select the colors you want simply use the up and down
arrow keys to select Foreground or Background and the
left and right arrow keys to select the color. A small
arrow will move over the chart showing you which color
you have picked and a sample of the colors will appear
to the right of the display.
Note that you may select from sixteen foreground and
sixteen background colors. The second eight background
colors are not really colors but cause the foreground
characters to blink by turning on the blink bit in the
color attribute byte. A little bit of blink, like hot
pepper sauce, goes a long way.
The color combination you select will stay in effect
for the rest of the BOX session or until you change it
regardless of whether you are typing text, drawing
boxes or painting.
Be sure you don't select the same background and
foreground colors. If you do everything you draw or
type will be invisible.
BLOCK FUNCTIONS
When you select BLOCK from the Draw menu, your first
step is to identify the portion of the screen, or the
block, you want to work with. Do this by moving the
cursor to one corner of the block and hitting enter,
then moving the cursor to the opposite corner of the
block and hitting enter again. After you anchor the
cursor on the first corner the program will highlight
the block area by displaying it in reverse video.
=======================================================
BOX USER GUIDE PAGE 15
=======================================================
After you have identified the block size, the program
will display a submenu of functions.
MOVE BLOCK
If you select MOVE BLOCK from the BLOCK menu simply
use the cursor keys to move the identified block
around the screen until you have placed it where you
want it. Hit enter to position the block. The area
where the original block was located is blanked out.
CLONE BLOCK
CLONE BLOCK is the same as MOVE BLOCK except that
the original block is not blanked out but is left
intact. So if you have created a fancy small
pattern in one area of the screen that you want to
repeat at other locations, use CLONE to move it.
PAINT BLOCK
PAINT allows you to change the background and
foreground colors of the selected block area of the
screen. Other PAINT functions are more global and
operate on the interior of box lines, for example.
But BLOCK PAINT allows you to pinpoint just where
you want to change the colors.
BLANK BLOCK
This function blanks the selected area of the
screen.
DEFINE NEXT BLOCK
Use DEFINE to select another area of the screen for
block operations.
SELECT BOX-DRAWING STYLE
Returning now to functions available from the main DRAW
menu, the SELECT BOX TYPE facility allows you to select
from among double line, single line or combination
single/double line boxes. Simply pick the one you
like. The box type you select will stay in effect
until you change it even if you are not drawing.
=======================================================
BOX USER GUIDE PAGE 16
=======================================================
REPEAT
The REPEAT function has two parts. First REPEAT will
allow you to enter the character you want to repeat.
An ASCII character selection window will pop up on the
right side of the screen. Browse the ASCII table by
using the Up and Down arrow keys and PageDown and
PageUp keys. Then hit enter to select.
In the second step REPEAT will pause while you position
the cursor anywhere on the screen. When you have
positioned the cursor where you want it, hit enter to
trigger the REPEAT function. You may now "draw" the
repeat character any direction using the arrow keys.
REPEAT works just like DRAW except you get to select
any of the PC's 255 characters to draw with.
Note that the character you select from the ASCII Table
will stay at-the-ready for later Repeat-Drawing if you
need it. Just hit ALT-R to invoke the on-the-fly
repeat function and you can "draw" the last-selected
ASCII character in any direction. The ASCII Table can
also be brought up On-the-fly by hitting ALT-A.
PAINT AREAS
The PAINT function contains several choices for
painting parts or all of the screen different colors.
COLOR
Before selecting any of the paint functions it is
necessary to choose the background and foreground
colors you want the painted area to be. The COLOR
smorgasbord allows the color selection.
INTERIOR PAINT
This function paints the interior of boxes but stops
painting on the box boundary. To use the function
move the cursor inside the box to be painted and hit
enter. PAINT will start from the cursor position
painting in every direction until it hits the box
lines. Make sure there are no gaps in the box
because PAINT will leak through the gap and paint
the entire screen.
LINE PAINT
=======================================================
BOX USER GUIDE PAGE 17
=======================================================
This function will follow any boxes or lines you
have drawn and paint them the color you have
selected. Put the cursor on the line you want to
paint and hit enter.
SCREEN PAINT
Choose this function to change the colors of the
entire screen.
FILL
The FILL function fills the area selected with a
character of your choice. When you select the
function an ASCII selector table will pop up for
character selection and you will be prompted to move
the cursor inside the area to be filled. FILL will
not leak into or out of boxes. The function is
often used to create attractive background patterns
around windows on the screen.
These PAINT functions sounds complicated but play with
them a while and you will get the hang of them right
away. Just remember that if you select the same
background color that you have in the box to start
with, PAINT will appear as if it is not working if
there are no typed labels in the box.
With the exception of the FILL function, the PAINT
functions do not destroy characters you have typed on
the screen. They simply change the color attributes.
This fact can be used to advantage if you want to leave
the background color the same but change the
foreground. For example if you have white characters
on a blue background and you wish to have yellow
characters on the same blue background then simply
select yellow on blue and paint the area you want to
change.
The PAINT functions test to see if they have completed
their tasks by looking at the colors all around where
they start. If the colors there are the desired PAINT
colors the function thinks it is done and does no
further processing. So be sure to move the cursor into
an area that is not the paint color to start.
If you have several areas to paint the same color move
the cursor into the next area and hit ALT-P to invoke
=======================================================
BOX USER GUIDE PAGE 18
=======================================================
the on-the-fly PAINT function.
ERASE
While you are drawing, sooner or later you will turn a
corner too soon or make some other mistake. To correct
these mistakes, select ERASE. In essence, ERASE writes
a blank character wherever the cursor is directed.
ERASE does not restore the background color to what it
was before. To accomplish this you must make a color
change before you start ERASING.
ON THE FLY CHANGES
After you become familiar with the DRAW MENU functions
and memorize the initials -- D for DRAW, M for MOVE and
so on -- you will want to take advantage of the ON THE
FLY CHANGES. This facility allows you to change
drawing functions on-the-fly while you are drawing
simply by pressing a key. When you use this feature
there is no need to return to the menu and select
another function.
For example while you are drawing a box you can hit
ALT-M and BOX immediately switches you into the MOVE
function. You may then move the cursor a few spaces,
hit ALT-D and you're drawing a new box. ON-THE-FLY
functions are quick and powerful but they happen
without fanfare so you will have to remember what you
are doing.
ON THE FLY functions duplicate those available from the
menu except for PAINT and REPEAT which work slightly
differently. In their ON-THE-FLY forms PAINT and
REPEAT are toggle functions you may turn on and off.
For example if you are DRAWING you could hit ALT-M for
MOVE, move the cursor inside a box and then hit ALT-P
to toggle PAINT on and PAINT the box. This procedure
varies from the three-part PAINT and REPEAT sequence
the program steps you through when these functions are
selected from the menu.
ON-THE-FLY FUNCTIONS AVAILABLE
ALT-T = TYPE LABELS
ALT-D = DRAW BOXES
=======================================================
BOX USER GUIDE PAGE 19
=======================================================
ALT-M = MOVE
ALT-C = COLOR CHANGE
ALT-B = BLOCK FUNCTIONS
ALT-S = SELECT BOX TYPE
ALT-E = ERASE
ALT-A = ASCII TABLE
ALT-R = REPEAT (TOGGLE ONLY)
ALT-P = PAINT (TOGGLE ONLY)
ASCII TABLE (ALT-A)
One unique on-the-fly function that is not directly
available from the menu (it is available indirectly
from the REPEAT function) is the ASCII Table. If you
want to use one of the upper or lower ASCII characters
which cannot be entered from the keyboard on the
screen, simply hit ALT-A. An ASCII Table will pop up
on the right side of the screen with a selector box
that you move with the arrow keys. Move the selector
box over the character you want, scrolling with the
arrow keys or PageDown or PageUp if necessary, then hit
enter to select. The ASCII table will disappear and
the character you selected will be printed on the
screen at the last cursor position.
The ASCII character you last selected from the ASCII
table will stay at-the-ready to be used in the REPEAT
function. To select the on-the-fly REPEAT function hit
ALT-R. This combination of ASCII Table selection and
REPEAT is a very powerful facility to create
interesting and unusual effects with some of the
"strange" ASCII characters. Some amazing displays can
be created using the block and shading characters in
unusual color combinations. The possibilities for
attention-getting program logo screens are endless.
TURBO PASCAL PROGRAMMING CONSIDERATIONS
Creating screen images with BOX is easy and fun but it
is only half the story. The real payoff comes when you
integrate the screens into your own Turbo Pascal
program.
Displaying and using BOX-created screens in your Turbo
Pascal programs is relatively easy. The Pascal Unit
=======================================================
BOX USER GUIDE PAGE 20
=======================================================
LOADFILE.PAS contains source code you can use to load
any of the three BOX format screens onto the display.
DISPLAYING ASCII FORMAT SCREENS
To display ASCII format screens created with the BOX
editor, add a procedure to your program which reads the
file produced by BOX and displays it line by line. The
following logic, a simplified version of Procedure
Load_ASCII in Unit LOADFILE.PAS, will give you the
idea.
VAR
FilevarA : Text;
BEGIN
Assign(FilevarA,'ANYFILE.ASC');
Reset(FilevarA);
ClrScr;
For II := 1 to 25 do
Begin
Readln(FilevarA,TempStr);
GoToXY(1,II);
Write(TempStr);
End;
Close(FilevarA);
END;
The example above will load BOX ASCII format file
ANYFILE.ASC onto the display. Copy and use the
procedure above or the more flexible procedure given in
Unit LoadFile in your own programs.
DISPLAYING MEMORY FORMAT SCREENS
Displaying a memory format screen requires a bit of
fiddling with the PC's video buffer. Forturnately you
don't have to know how it works because We've included
all the routines you need in Units IOSTUFF and
LOADFILE.
However for those that are curious here's a few
technical details. To display a screen you have saved
under the memory format you must read in the BOX-
created file and move the contents of the file directly
into the Video display memory buffer. This buffer is
located at memory address B800 (hex) for the color (CGA
or EGA) adapters and at memory address B000 (hex) for
the monochrome adapter. So the logic to display a
=======================================================
BOX USER GUIDE PAGE 21
=======================================================
memory file is as shown below:
TYPE
Map = Record { one char. and color attr.}
ScrCh : Char;
ScrAt : Byte;
End;
Screen = Array[1..25,1..80] of Map; {video memory}
VAR
FilevarM : File;
LoadScr : Screen; {holding screen}
ColorScr : Screen absolute $B800:0000; {color}
MonoScr : Screen absolute $B000:0000; {Mono}
BEGIN
Assign(FilevarM,'ANYFILE.MEM');
Reset(FilevarM,4000);
BlockRead(FilevarM,LoadScr,1); {read in the screen}
{now move into buffer}
Move(LoadScr,ColorScr,4000); {For CGA}
{ Move(LoadScr,MonoScr,4000); } {For Monochrome}
Close(FilevarM);
...
END;
The example above first reads memory format file
ANYFILE.MEM into holding area LoadScr. Then LoadScr is
moved directly into the CGA display memory. The
bracketed statements show how the logic would be
changed to display the screen on a monochrome display.
When you move the file into the video buffer the screen
image will pop onto the display almost instantly.
Moving data directly into the CGA adapter's memory will
cause interference or "snow" on the screen. The
interference happens so fast that it is not particulary
objectionable. However there is a way to avoid the
snow by using MoveToScreen, a special inline code
routine given in Unit IOSTUFF. There are also routines
in IOSTUFF which determine the type of adapter
installed so that your programs will work on any kind
of computer. I recommend you consider using the
Load_Mem Procedure in Unit LOADFILE.PAS to take
advantage of the advanced functionality. If you
include these Units the logic to display a screen is
dead simple:
Load_Mem('ANYFILE.MEM');
=======================================================
BOX USER GUIDE PAGE 22
=======================================================
This statement will pop BOX file ANYFILE.MEM on the
screen regardless of type of display. The screen will
appear just as you created it with BOX -- boxes,
colors, blink and all. After you have displayed the
screen you are free to write on it with normal Pascal
Write statements.
DISPLAYING PACKED FORMAT SCREENS
Displaying a Packed format screen is similar to
displaying a Memory format screen except the packed
screen file must be unpacked before it can be
displayed. A Packed format file uses a simple run
length encoding structure. The idea is that if there
are 20 blanks in a row on the screen, the Packed format
just saves the blank character once along with the run
length of 20. Here's a snippet of logic to show you
how to unpack a packed screen image:
TYPE
Map = Record { one char. and color attr.}
ScrCh : Char;
ScrAt : Byte;
End;
Screen = Array[1..25,1..80] of Map; {video memory}
Pack = Record
PackNm : Byte; {run length}
PackCh : Char; {repeated character}
PackAt : Byte; {repeated attribute}
End;
VAR
FilevarM : File;
LoadScr : Screen;
ColorScr : Screen absolute $B800:0000; {color}
MonoScr : Screen absolute $B000:0000; {Mono}
Packbuf : Array[1..2000] of Pack;
II,JJ,Sloc,SX,SY,NumRec : Integer;
BEGIN
Sloc := 1; {SLoc is location on screen}
Assign(FilevarM,'ANYFILE.PAK');
Reset(FilevarM);
BlockRead(FilevarM,PackBuf,48,NumRec);
=======================================================
BOX USER GUIDE PAGE 23
=======================================================
JJ := 0;
While Sloc < 2001 do
Begin {start unpacking}
JJ := JJ + 1;
For II := 1 to Packbuf[JJ].PackNm do
Begin
SY := (SLoc-1) div 80 + 1; {row}
SX := (SLoc-1) mod 80 + 1; {column}
{move in the character and attribute}
LoadScr[SY,SX].ScrCh := Packbuf[JJ].PackCh;
LoadScr[SY,SX].ScrAt := Packbuf[JJ].PackAt;
Inc(SLoc); {increment the screen location}
End;
End;
Move(LoadScr,ColorScr,4000); {for CGA}
{ Move(LoadScr,MonoScr,4000);} {for Mono}
Close(FilevarM);
END;
After the Packed format file has been unpacked it looks
just like a Memory format file and may then be moved
directly into the video memory buffer as shown in the
move statements above. The example procedure LOAD_PAK
contained on your disk in file LOADFILE.PAS is a more
comprehensive example of the technique and is ready to
use in your own programs.
USING BOX SCREENS FOR CONTEXT SENSITIVE HELP
It is relatively easy to create a context-sensitive
help facility in your Turbo Pascal program with the BOX
screen editor and a few simple routines such as those
contained on the BOX diskette in file KEY2.PAS.
The first step is to decide how many help screens you
need and during what processing steps you want the help
screens to display. Now use the BOX editor to create
each of the help screens. You may enter text, draw
lines, use different colors and get as fancy as you
wish. After you have completed each help screen save
it using a memory or packed format.
Now turn to your Turbo Pascal program. You will need
to make a decision and then make several minor
additionsto your program to tailor the help facility.
The decision is where you are going the store the help
screen images. You have three choices;
=======================================================
BOX USER GUIDE PAGE 24
=======================================================
(1) leave the files on disk and bring them in when
needed,
(2) preload the files into an array defined in your
program's storage or
(3) preload screens on unallocated memory (the heap).
The first apprach is simple, clean and saves memory but
it is comparitively slow. The second and third
approaches take more memory but allow eyepopping speed.
We use alternative three (store help screens on the
heap) in the BOX program.
To copy this approach first examine the help-related
procedures in Unit KEY2.PAS. You must first call
Procedure SETHELPMAX to set the number of active help
screens you intend to use. Then you must call
Procedure HELPLOAD once for each help screen to store
the screen on the heap. Here's the actual help-loading
statements we use in BOX.
Display('Loading Help Files',1,25);
SetHelpMax(7);
HelpLoad(1,'BoxHelp.1');
HelpLoad(2,'BoxHelp.2');
HelpLoad(3,'BoxHelp.3');
HelpLoad(4,'BoxHelp.4');
HelpLoad(5,'BoxHelp.5');
HelpLoad(6,'BoxHelp.6');
HelpLoad(7,'BoxHelp.7');
Wait;
These statements establish seven help screens and load
the actual screens in order on the heap. The numbers
are important because they establish the "context"
under which the screen will be displayed.
To use the concept of contextual help, assign values to
the global variable HELPCONTEXT (defined in Unit KEY2)
at various locations in your program corresponding to
the help screen you want to display. For example if
the help screen for your EDIT function is EDITHELP.MEM
and you have assigned it position No. 2 on the heap
through the statement HelpLoad(2,'EDITHELP.MEM'); then
be sure to set HELPCONTEXT := 2; in the first few
statements of your EDIT Procedure.
Now all that's left is to intercept each keystroke as
it is entered and check it to see if the user has
=======================================================
BOX USER GUIDE PAGE 25
=======================================================
pressed F1 (or whatever you wish the help key to be).
If the user has pressed the help key then your program
should pop the appropriate help screen on the display.
Function NEXTKEY in Unit KEY2 does this for you. As
long as you read in characters with function NEXTKEY,
and keep variable HELPCONTEXT set, the routines in Unit
KEY2 will do all the work. The right help screen will
flash on the monitor and, when the user hits a key,
will disappear leaving him at the exact spot he was
when he asked for help.
This business of context sensitive help sounds
complicated but it is not. Study the complete example
program ADDRESS.PAS to see how it is done.
ADDRESS.PAS, A COMPLETE EXAMPLE PROGRAM
ADDRESS.PAS on the BOX diskette is a complete Turbo
Pascal example program that uses BOX screens in three
different ways:
Program Logo screen
Context sensitive help screens
Database entry screen
ADDRESS is a simple name and address manager that
allows the user to browse, add, change or delete
entries from a list of addresses. The actual database
management portion of ADDRESS is simple and
unsophisticated to keep the program small. Rather the
emphasis is on the examples of using the BOX screens
effectively.
The ADDRESS program references several Units from
Nescatunga Software's Turbo Overdrive Package, a
collection of over 40 procedures and functions. The
Units which are included on the BOX diskette are:
IOSTUFF.PAS -- Low level screen and cursor routines
LOADFILE.PAS -- Load BOX screen onto the display
MENUBOX.PAS -- Popup menu window
GETLNE.PAS -- Take user's input from the screen
KEY.PAS -- Keystroke reading and help routines
We think you will find these Units extremely powerful
and useful. IOSTUFF alone is worth the price of BOX.
=======================================================
BOX USER GUIDE PAGE 26
=======================================================
CAPTURING SCREENS FROM OTHER PROGRAMS WITH GRAB
On the BOX disk you will find the program GRAB.COM, a
memory-resident screen capturing program. GRAB is a
program that, when activated by pressing the ALT key
and the PrtSc key simultaneously, saves the current
screen image to disk under BOX's Memory format. You
can use GRAB to capture screens from other programs and
later modify those screens using the BOX editor and
incorporate the screens into your own programs.
To use GRAB first run the program by typing GRAB at the
DOS prompt. GRAB will print a short message confirming
that it has been loaded. You may now proceed to run
any other program you wish. Whenever you want to save
the screen image hit the ALT-PrtSc keys and GRAB will
create a Memory format file containing the screen image
on the current disk drive. If the drive or directory
has been changed by the program or the batch file, GRAB
will write to the new drive and directory. Later you
can copy the files to whatever directory you wish. It
is a good idea to wait until the program you are
running is stable (i.e. waiting for a keystroke) before
trying to capture the screen.
When GRAB saves the screen it assigns a file name using
the convention BOXnnn.MEM. The nnn portion of the file
name starts with 000 and is incremented by one for each
file saved. So the first file will be named
BOX000.MEM, the second BOX001.MEM and so on.
GRAB saves files only in the Memory format but it is
easy to covert the file format later with BOX. Simply
LOAD the file using a Memory format and SAVE the file
using an ASCII or Packed format.